home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 15 / CU Amiga Magazine's Super CD-ROM 15 (1997)(EMAP Images)(GB)[!][issue 1997-10].iso / CUCD / Graphics / Ghostscript / source / gsinit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-08  |  2.0 KB  |  70 lines

  1. /* Copyright (C) 1989, 1995, 1996 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gsinit.c */
  20. /* Initialization for the imager */
  21. #include "stdio_.h"
  22. #include "memory_.h"
  23. #include "gdebug.h"
  24. #include "gscdefs.h"
  25. #include "gsmemory.h"
  26. #include "gp.h"
  27. #include "gslib.h"        /* interface definition */
  28.  
  29. /* Imported from gsmisc.c */
  30. extern FILE *gs_debug_out;
  31.  
  32. /* Imported from gsmemory.c */
  33. void gs_malloc_init(P0());
  34. void gs_malloc_release(P0());
  35.  
  36. /* Configuration information from gconfig.c. */
  37. extern_gx_init_table();
  38.  
  39. /* Initialization to be done before anything else. */
  40. void
  41. gs_lib_init(FILE *debug_out)
  42. {    gs_lib_init0(debug_out);
  43.     gs_lib_init1(&gs_memory_default);
  44. }
  45. void
  46. gs_lib_init0(FILE *debug_out)
  47. {    gs_debug_out = debug_out;
  48.     gs_malloc_init();
  49.     /* Reset debugging flags */
  50.     memset(gs_debug, 0, 128);
  51.     gs_log_errors = 0;
  52. }
  53. void
  54. gs_lib_init1(gs_memory_t *mem)
  55. {    /* Run configuration-specific initialization procedures. */
  56.     { void (**ipp)(P1(gs_memory_t *));
  57.       for ( ipp = gx_init_table; *ipp != 0; ++ipp )
  58.         (**ipp)(mem);
  59.     }
  60. }
  61.  
  62. /* Clean up after execution. */
  63. void
  64. gs_lib_finit(int exit_status, int code)
  65. {    fflush(stderr);            /* in case of error exit */
  66.     /* Do platform-specific cleanup. */
  67.     gp_exit(exit_status, code);
  68.     gs_malloc_release();
  69. }
  70.